﻿using DBUtility;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace WeChat
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            //log4net.Config.XmlConfigurator.Configure(new FileInfo(Server.MapPath("~/Web.config")));
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(Server.MapPath("Log4net.config")));


            //ado.net 操作数据库  基本的方式
            string strSeciont = "connections/conndetail";
            var cfgObject = ConfigurationManager.GetSection(strSeciont);
            NameValueCollection nvColl = (NameValueCollection)cfgObject;
            DbHelper.ValCode = "Xie20O1lWangM";
            //DbHelper.StrConnectionString = nvColl["conString"];
            //DbHelper.StrConnectionString = "Data Source=10.0.0.77;Initial Catalog=LittleLotus;User Id=sa;Password=Xie201307;Integrated Security=false;Connect Timeout=60";
            DbHelper.StrConnectionString = ConfigurationManager.AppSettings["conString"];
        }
    }
}
